﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetNuke.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SimpleBlog.Tests
{
    public class TestBase
    {

        //Use ClassInitialize to run code before running the first test in the class
        public static void TestClassInitialize(TestContext testContext)
        {
            ComponentFactory.Container = new SimpleContainer();
            ComponentFactory.RegisterComponentInstance<SimpleBlog.Components.Data.IDataProvider>(new SimpleBlog.Components.Data.SqlDataProvider());

            //Install most Providers as Singleton LifeStyle
            //ComponentFactory.InstallComponents(new ProviderInstaller("data", typeof(DotNetNuke.Data.DataProvider)));

            //ComponentFactory.InstallComponents(new ProviderInstaller("caching", GetType(Services.Cache.CachingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("logging", GetType(Services.Log.EventLog.LoggingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("scheduling", GetType(Services.Scheduling.SchedulingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("searchIndex", GetType(Services.Search.IndexingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("searchDataStore", GetType(Services.Search.SearchDataStoreProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("friendlyUrl", GetType(Services.Url.FriendlyUrl.FriendlyUrlProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("members", GetType(DotNetNuke.Security.Membership.MembershipProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("roles", GetType(DotNetNuke.Security.Roles.RoleProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("profiles", GetType(DotNetNuke.Security.Profile.ProfileProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("permissions", GetType(DotNetNuke.Security.Permissions.PermissionProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("outputCaching", GetType(DotNetNuke.Services.OutputCache.OutputCachingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("moduleCaching", GetType(DotNetNuke.Services.ModuleCache.ModuleCachingProvider)));
            //ComponentFactory.InstallComponents(new ProviderInstaller("sitemap", GetType(DotNetNuke.Services.Sitemap.SitemapProvider)));

            //Dim provider As DotNetNuke.Security.Permissions.PermissionProvider = DotNetNuke.ComponentModel.ComponentFactory.GetComponent(Of DotNetNuke.Security.Permissions.PermissionProvider)()
            //If provider Is Nothing Then
            //    ComponentFactory.RegisterComponentInstance(Of DotNetNuke.Security.Permissions.PermissionProvider)(new DotNetNuke.Security.Permissions.PermissionProvider())
            //End If

            ////Install Navigation and Html Providers as NewInstance Lifestyle (ie a new instance is generated each time the type is requested, as there are often multiple instances on the page)
            //ComponentFactory.InstallComponents(new ProviderInstaller("htmlEditor", GetType(Modules.HTMLEditorProvider.HtmlEditorProvider), ComponentLifeStyleType.Transient))
            //ComponentFactory.InstallComponents(new ProviderInstaller("navigationControl", GetType(Modules.NavigationProvider.NavigationProvider), ComponentLifeStyleType.Transient))

        }

        //Use ClassCleanup to run code after all tests in a class have run
        public static void TestClassCleanup()
        {
        }

    }
}
